
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="org.wso2.carbon.registry.custom.dia.ui.utils.AddDocumentUtil" %>
<%@ page import="org.wso2.carbon.registry.common.ui.UIException" %>
<%@ page import="org.wso2.carbon.registry.custom.dia.ui.clients.TopicServiceClient" %>

<%
     String sPath = request.getParameter("sPath");
    
     try {
        
        AddDocumentUtil.applyTags(request, config, session); //add tags
 
         TopicServiceClient client = new TopicServiceClient(config, session);

    //     String dPath = request.getParameter("diaRelDoc1");
    //     dPath += "../../../resources/resource.jsp?path="+dPath;

         String type = "Related Doc";
         client.addAssociation(sPath,"http://add2.jsp.add",type);
    } catch (UIException e) {
            System.out.println("Could not add documentation.");
    } catch (Exception e){
            System.out.println("Exception thrown when adding a new documentation.");
    }

    String resourcePagePath = "../../../resources/resource.jsp?path=" + sPath;
    response.sendRedirect(resourcePagePath);

    %>
 

<!--
/*
 *validation of diaRelDoc1
    if (reason == "") {
        typeForm.associationPaths.value = typeForm.associationPaths.value.replace(/^\s\s*
   ds      /, '').replace(/\s\s*$/, '');
        if (typeForm.associationPaths.value == "") {
            reason = org_wso2_carbon_registry_relations_ui_jsi18n["path.cannot.contain.only.white.spaces"];
        }
    }
 *
 */
-->